//----------------------------单四拍运行模式
#include <Arduino.h>

// put function declarations here:
int in1_pin = 5;
int in2_pin = 4;
int in3_pin = 3;
int in4_pin = 2;
void roll(int);

void setup()
{
  // put your setup code here, to run once:
  pinMode(in1_pin, OUTPUT);
  pinMode(in2_pin, OUTPUT);
  pinMode(in3_pin, OUTPUT);
  pinMode(in4_pin, OUTPUT);
}

void loop()
{
  // put your main code here, to run repeatedly:
  for (int i = 0; i < 512; i++)
  {
    roll(in1_pin);
    roll(in2_pin);
    roll(in3_pin);
    roll(in4_pin);
  }
  delay(1000);
  for (int i = 0; i < 512; i++)
  {
    roll(in4_pin);
    roll(in3_pin);
    roll(in2_pin);
    roll(in1_pin);
  }
  delay(1000);
}

// put function definitions here:
void roll(int in_pin)
{
  digitalWrite(in_pin, HIGH);
  delay(3);
  digitalWrite(in_pin, LOW);
}